// Copyright (C) 2024 Kumo inc.
// Author: Jeff.li lijippy@163.com
// All rights reserved.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published
// by the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program.  If not, see <https://www.gnu.org/licenses/>.
//
#pragma once

#include <turbo/flags/flag.h>
#include <turbo/flags/declare.h>

TURBO_DECLARE_FLAG(int32_t, codel_interval);
TURBO_DECLARE_FLAG(int32_t, codel_target_delay);
TURBO_DECLARE_FLAG(bool, dynamic_cputhreadpoolexecutor);

TURBO_DECLARE_FLAG(uint32_t,
    melon_global_io_executor_threads);

TURBO_DECLARE_FLAG(uint32_t,
    melon_global_cpu_executor_threads);

TURBO_DECLARE_FLAG(bool,
    melon_global_cpu_executor_use_throttled_lifo_sem);

TURBO_DECLARE_FLAG(uint32_t,
    melon_global_cpu_executor_wake_up_interval_us);

TURBO_DECLARE_FLAG(bool, dynamic_iothreadpoolexecutor);

TURBO_DECLARE_FLAG(int64_t,
    threadtimeout_ms);

TURBO_DECLARE_FLAG(bool,
    melon_futures_use_thread_wheel_timekeeper);

TURBO_DECLARE_FLAG(std::string,
    melon_event_base_poller_backend);
TURBO_DECLARE_FLAG(uint64_t,
    melon_event_base_poller_spin_us);
TURBO_DECLARE_FLAG(uint64_t,
    melon_event_base_poller_sleep_us);

// Epoll backend.
TURBO_DECLARE_FLAG(uint64_t,
    melon_event_base_poller_epoll_max_events);
TURBO_DECLARE_FLAG(bool,
    melon_event_base_poller_epoll_rearm_inline);

// io_uring backend.
TURBO_DECLARE_FLAG(uint64_t,
    melon_event_base_poller_io_uring_sq_entries);

TURBO_DECLARE_FLAG(bool,
    melon_hazptr_use_executor);

TURBO_DECLARE_FLAG(bool,
    melon_memory_idler_purge_arenas);

TURBO_DECLARE_FLAG(int32_t,
    observer_manager_pool_size);
TURBO_DECLARE_FLAG(int64_t,
    mlock_chunk_size);


TURBO_DECLARE_FLAG(bool, benchmark);

TURBO_DECLARE_FLAG(bool, json);

TURBO_DECLARE_FLAG(bool, bm_estimate_time);

#if MELON_PERF_IS_SUPPORTED
TURBO_DECLARE_FLAG(std::string,
    bm_perf_args);
#endif

TURBO_DECLARE_FLAG(bool,
    bm_profile);

TURBO_DECLARE_FLAG(int64_t,
    bm_profile_iters);

TURBO_DECLARE_FLAG(std::string,
    bm_relative_to);

TURBO_DECLARE_FLAG(bool,
    bm_warm_up_iteration);

TURBO_DECLARE_FLAG(std::string,
    bm_json_verbose);

TURBO_DECLARE_FLAG(std::string,
    bm_regex);

TURBO_DECLARE_FLAG(int64_t,
    bm_min_usec);

TURBO_DECLARE_FLAG(int32_t,
    bm_min_iters);

TURBO_DECLARE_FLAG(int64_t,
    bm_max_iters);

TURBO_DECLARE_FLAG(int32_t,
    bm_max_secs);

TURBO_DECLARE_FLAG(uint32_t,
    bm_result_width_chars);

TURBO_DECLARE_FLAG(uint32_t,
    bm_max_trials);

TURBO_DECLARE_FLAG(bool,
    bm_list);

namespace melon {

    void parse_args(int argc, char** argv, bool verbose = false);
}
